import java.util.Scanner;

public class Practice {


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        double f1 = scanner.nextDouble();
        double f2 = scanner.nextDouble();
        double f3 = scanner.nextDouble();
        System.out.println(max(n,m));
        System.out.println(max(f1,f2,f3));
    }
    public static int max(int x,int y) {
        if(x > y) {
            return x;
        }else {
            return y;
        }
    }
    public static double max(double f1,double f2,double f3) {
        double max = 0;
        if((f1 - f2) > 0){
            max = f1;
        }else {
            max = f2;
        }
        if((max - f3) > 0) {
            return max;
        }else {
            max = f3;
        }
        return max;
    }
    public static void main12(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        double f1 = scanner.nextDouble();
        double f2 = scanner.nextDouble();
        double f3 = scanner.nextDouble();
        int sum1 = add(n,m);
        double sum2 = add(f1,f2,f3);
        System.out.println(sum1);
        System.out.println(sum2);
    }

    public static int add(int n,int m) {
        return m + n;
    }
    public static double add(double f1,double f2,double f3) {
        return (f1 + f2 + f3);
    }
    public static void main10(String[] args) {
        //Scanner scanner =new Scanner(System.in);
        //int n = scanner.nextInt();
        //Print(n);
//        Scanner scanner =new Scanner(System.in);
//        int count = 0;
//        while(count < 3) {
//            String str = scanner.nextLine();
//            if(login(str) == true){
//                System.out.println("登陆成功");
//                break;
//            }else {
//                System.out.println("密码错误，请重新输入");
//                System.out.println("你还有" + (2-count) + "次机会");
//                count++;
//            }
//
//        }
//        if(count == 3){
//            System.out.println("密码输入错误三次，退出程序");
//        }
//        Scanner scanner =new Scanner(System.in);
//        int n = scanner.nextInt();
//        print1(n);
//
//        Scanner scanner =new Scanner(System.in);
//        int n = scanner.nextInt();
//        int m = scanner.nextInt();
//        int k = scanner.nextInt();
//        int max = max3(n,m,k);
//        System.out.println(max);

        Scanner scanner =new Scanner(System.in);
        int n = scanner.nextInt();
        int ret = fib(n);
        System.out.println(ret);

    }
    public static int fib(int num){
        int n = 1;
        int m = 1;
        int k = 1;
        while(num > 2) {
            k = n + m;
            m = n;
            n = k;
            num--;
        }
        return k;
    }


    public static int max2(int x,int y) {
        if(x > y){
            return x;
        }else {
            return y;
        }
    }
    public static int max3(int x,int y,int z) {
        int max = 0;
        max = max2(x,y);
        max = max2(max,z);
        return max;
    }
    public static void print1(int n) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(i + "*" + j + "=" + (i*j) + " ");
            }
            System.out.println();
        }
    }
    public static boolean login(String str) {
        String password = "我喜欢你";
        if(str.equals(password)) {
            return true;
        }else {
            return false;
        }
    }
    public static void Print(int num) {
        while(num != 0) {
            System.out.print((num % 10)+" ");
            num /= 10;
        }
    }

    public static void main8(String[] args) {
        double sum = 0;
        int flag = 1;
        for (int i = 1; i <= 100; i++) {
            sum += flag*(1.0/i);
            flag = -flag;
        }
        System.out.println(sum);
    }
    public static void main7(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int t = n % m;
        while(t != 0) {
            n = m;
            m = t;
            t = n % m;
        }
        System.out.println(m);
    }
    public static void main6(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        int temp = n;
        while(temp != 0) {
            if(((temp & 1) == 1)){
                count++;
            }
            temp >>>= 1;
        }
        System.out.println(count);
    }
    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int i = 0;
        for (i = 2; i < n; i++) {
            if(n % i == 0){
                System.out.println("NO");
            }
        }
        if(n == i){
            System.out.println("YES");
        }
    }
    public static void main3(String[] args) {
        for (int year = 1000; year <= 2000; year++) {
            if((year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0))) {
                System.out.print(year+" ");
            }
        }
    }
    public static void main2(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if(i % 10 == 9){
                count++;
            }
            if(i / 10 == 9){
                count++;
            }
        }
        System.out.println(count);
    }
    public static void main1(String[] args) {
        int i = 0;
        int j = 0;
        for (i = 1; i <= 100; i++) {
            for (j = 2; j < i; j++) {
                if(i % j == 0){
                    break;
                }
            }
            if(i == j){
                System.out.print(i+" ");
            }
        }
    }
}
